<?
require_once("../config/dbconn.php");require_once("../config/usercls.php");require_once("pwd1cls.php");

if($act=='pwdedit'){
	$msg='';
	if(trim($pwd)=='') $msg.="请输入登录密码\\n";
	if(trim($repwd)=='') $msg.="请确认登录密码\\n";
	if ($pwd!=$repwd) $msg.="二次登录密码不一致\\n";
	if(trim($pwd1)=='') $msg.="请输入二级密码\\n";
	if(trim($repwd1)=='') $msg.="请确认二级密码\\n";
	if ($pwd1!=$repwd1) $msg.="二次二级密码不一致\\n";
	if ($msg!=''){
		echo "<script>alert('$msg');history.back();</script>";exit();
	}
	//插入数据库
	$dataArray['pwd']=authcode($pwd,"ENCODE");
	$dataArray['pwd1']=authcode($pwd1,"ENCODE");
	$condition="id='".$_SESSION['sys_userid']."'";
	$db->update("{$db_prefix}users",$dataArray,$condition);
	echo "<script>alert('密码已经修改');location.href='info_pwd.php';</script>";exit();
}

$sql1="select * from {$db_prefix}users where id='".$_SESSION['sys_userid']."'";
$rs1=$db->get_one($sql1);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	 background-image: url(image1/bg-body.png);
}
td{
	font-size:12px;
}
.red{
	color:#FF0000
}
-->
</style>

<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg1.png"><img src="images/left-top-right1.png" width="17" height="29" /></td>
    <td width="100%" height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">&nbsp;&nbsp;密码修改</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.png"><img src="images/nav-right-bg.png" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg1.png">&nbsp;</td>
    <td valign="top"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top">
		<form id="form1" name="form1" method="post" action="?act=pwdedit">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="3"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                <tr>
                  <td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="30" colspan="3">
			  
			  <table width="100%" height="120" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="30" align="center" class="left_txt">会员</td>
				   <td height="30" align="left"><?=$rs1['username']?></td>
                  </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">登录密码</td>
                  <td height="30" class="left_txt"><input name="pwd" type="password" id="pwd">
                    <span class="red">                    * </span></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">确认登录密码</td>
                  <td height="30" class="left_txt"><label>
                  <input name="repwd" type="password" id="repwd">
                    <span class="red"> * </span></label></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">二级密码</td>
                  <td height="30" class="left_txt"><label>
                  <input name="pwd1" type="password" id="pwd1">
                    <span class="red"> * </span></label></td>
                </tr>
				   <tr>
                  <td height="30" align="center" class="left_txt">确认二级密码</td>
                  <td height="30" class="left_txt"><label>
                  <input name="repwd1" type="password" id="repwd1">
                    <span class="red"> * </span></label></td>
                </tr>
              </table></td>
            </tr>
            
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
            <tr>
              <td width="50%" height="30" align="right"><input type="submit" value="修改" name="B1" /></td>
              <td width="6%" height="30" align="right">&nbsp;</td>
              <td width="44%" height="30">&nbsp;</td>
            </tr>
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
          </table>
		  </form>
		  </td>
      </tr>
    </table></td>
    <td background="images/mail_rightbg.png">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg1.png"><img src="images/buttom_left2.png" width="17" height="17" /></td>
      <td height="17" valign="top" background="images/buttom_bgs.png"><img src="images/buttom_bgs.png" width="17" height="17" /></td>
    <td background="images/mail_rightbg.png"><img src="images/buttom_right2.png" width="16" height="17" /></td>
  </tr>
</table>

</body>
</html>